struct ListNode* deleteNode(struct ListNode* head, int val) {
    if (head == NULL)
        return NULL;
    if (head->val == val)
    {
        return head->next;
    }
    else
    {
        struct ListNode* cur = head;
        struct ListNode* prev = NULL;
        while (cur)
        {
            if (cur->val == val)
                break;
            prev = cur;
            cur = cur->next;
        }
        if (cur)
        {
            prev->next = cur->next;
        }
        return head;
    }
}